import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:shouyin_app/common/base/base_get_controller.dart';
import 'package:shouyin_app/common/router/app_pages.dart';
import 'package:shouyin_app/pages/order/order.dart';
import 'package:shouyin_app/pages/setting/setting.dart';
import 'package:shouyin_app/pages/shop/shop.dart';
import 'package:shouyin_app/pages/table/table.dart';

class HomeController extends BaseGetController {

  int selectedIndex = 0;

  bool isExtended = false;

  late PageController pageController;


  List<Widget> pages = [
    TableView(),
    ShopView(),
    OrderView(),
    SettingView(),
  ];

  void _updatePage() {
    update(['update_page']);
  }

  void onSelected(int index) {
    selectedIndex = index;
    pageController.jumpToPage(selectedIndex);
    _updatePage();
  }

  void onExtended() {
    isExtended = !isExtended;
    _updatePage();
  }

  @override
  void onInit() {
    pageController = PageController(initialPage: selectedIndex);
    super.onInit();
  }

  void goPutOrderPage(BuildContext context) {
    context.pushNamed(AppPages.putOrder);
  }



}